<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<script src="${ctx}/resources/plugin/ratyli/jquery.ratyli.js"></script>
<script type="text/javascript">
        $(function(){
            $("#merchantDemandOrder_list tr:gt(0)").click(function(){
 	    	   if($(this).find(":radio").attr("checked")=="checked"){
 	    		     $(this).find(":radio").attr("checked",false);
 		    	   }else{
 		             $(this).find(":radio").attr("checked",true);
 		    	   }
            });
        });
    	function exportMerchantOrderExcel(obj){
    		debugger
    		var form = $(obj).parents("form");
    		var url = $('#merchantOrderExportForm').attr("action");
    		$('#merchantOrderExportForm').attr("action", url + "?" + form.serialize());  	
    		$('#merchantOrderExportForm').submit();
    		$('#merchantOrderExportForm').html("");
    	
    	}
    </script>
<!-- 顶部模块[如：功能按钮、搜索面板] -->
<div class="bjui-pageHeader" style="background: #FFF;">
 <form id="merchantOrderExportForm" style="display: none;" method="post" action="${ctx}/bus/merchantDemandOrderAction/exportMerchantOrder">
 </form> 
	<form id="pagerForm" data-toggle="ajaxsearch"
		action="${ctx}/bus/merchantDemandOrderAction/doList" method="post">
		<input type="hidden" name="pageSize" value="${pageResult.pageSize}">
		<input type="hidden" name="pageCurrent" value="${pageResult.pageCurrent}"> 
		<input type="hidden" name="orderField" value="${pageResult.orderField}">
		<input type="hidden" name="orderDirection" value="${pageResult.orderDirection}">
		<hr style="margin-top: 5px; margin-bottom: 5px">
		<div style="margin-bottom: 5px">
			<label>商户名称：
				<input id="merchantName" type="text" value="${pageResult.ext.merchantName }" name="merchantName" placeholder="请输入商户名称" style="width: 140px;"  />
			</label>
			<label>商品名称：
				<input id="goodsName" type="text" value="${pageResult.ext.goodsName }" name="goodsName" placeholder="请输入商品名称" style="width: 140px;"  />
			</label> 
			<label>订单号：
				<input id="orderNum" type="text" value="${pageResult.ext.orderNum }" name="orderNum" placeholder="请输入订单号" style="width: 140px;"  />
			</label> 
			<label>开始时间：
				<input type="text" name="startTime" data-toggle="datepicker" data-pattern="yyyy-MM-dd" value="${pageResult.ext.startTime}" size="20"  placeholder="请输入开始时间" > 
			</label> 
			<label >结束时间：
				<input type="text" name="endTime" data-toggle="datepicker" data-pattern="yyyy-MM-dd" value="${pageResult.ext.endTime}" size="20"  placeholder="请输入结束时间" > 
			</label> 
			</div>
			<div style="margin-bottom:5px">
			<label>订单状态：
				<select data-toggle="selectpicker" name="orderStatusId">
				<option value="">全部</option>
					<c:forEach items="${orderStatusList}" var="orderStatus">
							<c:choose>
								<c:when test="${orderStatus.codeValue == pageResult.ext.orderStatusId}">
									<option value="${orderStatus.codeValue}" selected >${orderStatus.codeName }</option>
								</c:when>
								<c:otherwise>
									<option value="${orderStatus.codeValue}" >${orderStatus.codeName }</option>
								</c:otherwise>
							</c:choose>
							
					</c:forEach>
			</select> 
			</label>
			<button class="btn-default" data-icon="search">查询</button>
			<button class="btn-default" data-clear-query="true"  data-icon="undo" data-toggle="reloadsearch">清空查询</button>
		  	<button class="btn-default" data-icon="sign-out" onclick="exportMerchantOrderExcel(this)">导出</button> 
		</div>
	</form>
</div>
<!-- 内容区 -->
<div class="bjui-pageContent tableContent" id="merchantDemandOrder_list">
	<table id="doc-datagrid-table" 
		class="table table-bordered table-hover table-striped table-top">
		<thead>
			<tr class="m_th_row">
				<th>选择</th>
				<th>商户名称</th>
				<th>商品类型</th>
				<th>航班类型</th>
				<th>订单总价格</th>
				<th>订单号</th>
				<th>订单状态</th>
				<th>创建时间</th>	
				<th>查看详情</th>
			</tr>
		</thead>
		<tbody>
			<c:forEach items="${pageResult.list}" var="u">
				<tr data-id="${u.id}" class="m_th_row">
					<td><input name="merchantDemandOrder_list" type="radio"  /></td>
					<td>${u.merchantName}</td>
					<td>${u.goodsTypeName}</td>
					<td>${u.flightTypeName}</td>
					<td>${u.orderTotalPrice}</td>
					<td>${u.orderNum }</td>
					<td>${u.orderStatusName}</td>
					<td><fmt:formatDate value="${u.createOrderTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
					<td>	
						<button type="button" class="btn btn-default" data-toggle="dialog"
							data-options="{id:'userOrderDetailDialog',url:'${ctx}/bus/merchantDemandOrderAction/getOrderDetailByParam',type:'post',data:{id:${u.id}}}"
							data-width="900" data-height="600" data-id="dialog-user-role"
							data-title="订单详情">详情</button>
					</td>
				</tr>
			</c:forEach>

		</tbody>
	</table>
</div>
<!-- 底部模块[如：工具条、分页组件]  -->
<div class="bjui-pageFooter">
	<div class="pages">
		<span>每页 </span>
		<div class="selectPagesize">
			<select data-toggle="selectpicker"
				data-toggle-change="changepagesize">
				<option value="10">10</option>
				<option value="30">30</option>
				<option value="60">60</option>
				<option value="100">100</option>
			</select>
		</div>
		<span> 条，共 ${pageResult.total} 条</span>
	</div>
	<div class="pagination-box" data-toggle="pagination"
		data-total="${pageResult.total}"
		data-page-size="${pageResult.pageSize}"
		data-page-current="${pageResult.pageCurrent}"></div>
</div>

